package com.hh.service.service.impl.socialize;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hh.common.model.socialize.UserSocializeView;
import com.hh.common.vo.user.UserSocializeViewVo;
import com.hh.service.dao.socialize.UserSocializeViewDao;
import com.hh.service.service.socialize.UserSocializeViewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class UserSocializeViewServiceImpl extends ServiceImpl<UserSocializeViewDao,UserSocializeView> implements UserSocializeViewService {

    @Resource
    private UserSocializeViewDao dao;

    @Override
    public List<String> getViewList() {
        List<String> list = new ArrayList<>();
        List<UserSocializeViewVo> userSocializeViewVos = dao.getViewList();
        if(userSocializeViewVos.size() > 0){
            for (UserSocializeViewVo userSocializeViewVo : userSocializeViewVos) {
                list.add(userSocializeViewVo.getAvatar());
            }
        }
        return list;
    }

    @Override
    public void replaceInto(UserSocializeView userSocializeView) {
        dao.replaceInto(userSocializeView);
    }
}
